package nl.isaac.labs.mobile.client;

import com.google.gwt.core.client.GWT;
import com.google.gwt.mobile.widgets.ui.Slide;
import com.google.gwt.mobile.widgets.ui.SlidePanel;
import com.google.gwt.mobile.widgets.ui.SlidePanel.SlideProvider;
import com.google.gwt.mobile.widgets.ui.TransitionWidget;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Widget;

public class SlidePanelPage extends TransitionWidget implements SlideProvider {

  @UiField
  SlidePanel slidePanel;

  private static SlidePanelPageUiBinder uiBinder = GWT.create(SlidePanelPageUiBinder.class);

  interface SlidePanelPageUiBinder extends UiBinder<Widget, SlidePanelPage> {
  }

  public SlidePanelPage() {
    initWidget(uiBinder.createAndBindUi(this));

    slidePanel.setSlideCount(10);
    slidePanel.setSlideProvider(this);
  }

  @Override
  public Slide loadSlide(final int index) {
    if (index < 2) {
      return null;
    }
    Slide slide = new Slide();
    slide.addStyleName("Slide-Content");
    slide.add(new HTML("Slide Me!"));
    slide.add(new HTML("Dynamic Slide " + index));
    return slide;
  }

}
